package com.qianfeng.secret;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Base64;
import android.widget.TextView;

import com.zhangwei.day43bluetooth.R;

/**
 * Md5是不可逆的加密算法
 * Aes Base64 是可逆的加密算法
 *
 *
 */
public class SecretActivity extends AppCompatActivity {
    private String msg = "微笑向暖,安之若素,你若盛开,清风自来";
    private TextView textView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_secret);
        textView = (TextView) findViewById(R.id.msg);
//        String encroy = MD5Utils.MD5(msg);
//        textView.setText(encroy);
//        String encrypt = AesUtil.encrypt(msg);
//        textView.setText(encrypt);
//        String decrypt = AesUtil.decrypt(encrypt);
        String encode = new String(Base64.encode(msg.getBytes(), Base64.DEFAULT));
//        textView.setText(encode);
        String decode = new String(Base64.decode(encode, Base64.DEFAULT));
        textView.setText(decode);

    }
}
